package com.dongdongshop.controller;

import com.dongdongshop.domain.AjaxResult;
import com.dongdongshop.pojo.TbContent;
import com.dongdongshop.service.ContentService;
import em.ResuleEnum;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping("content")
public class ContentController {

    @DubboReference
    private ContentService contentService;

    @RequestMapping("lunboList")
    @ResponseBody
    public AjaxResult lunboList(){
        List<TbContent> list = contentService.selectByCotegoryId();
        return AjaxResult.R(ResuleEnum.SUCCESS).setData(list);
    }

    @RequestMapping("tuijianList")
    @ResponseBody
    public AjaxResult tuijianList() {
        List<TbContent> list = contentService.tuijianList();
        return AjaxResult.R(ResuleEnum.SUCCESS).setData(list);
    }

    @RequestMapping("xihuanList")
    @ResponseBody
    public AjaxResult xihuanList() {
        List<TbContent> list = contentService.xihuanList();
        return AjaxResult.R(ResuleEnum.SUCCESS).setData(list);
    }
}
